<template>
<div class="account_table_t">
	<el-table
    :data="transactionList.list"
    style="width: 100%;border:10px;background-color: #212C4F;"
    :empty-text ="$lang('No_data')"
  	:row-style="{
  		'border':'none',
  		'background-color':'#1D2748',
  		'border-bottom':'none',
  	}"	
  	>
    <el-table-column
      prop="blockheight"
      :label="$lang('BLOCK_TAB')"
      width="200">
    </el-table-column>
    <el-table-column
      prop="name"
      :label="$lang('TIME')"
      width="140">
      <template slot-scope='scope' >{{ $filterTime(scope.row.time) }}</template>
    </el-table-column>
    <el-table-column
      prop="hash"
      :label="$lang('TXN')">
      <template scope='scope' ><router-link style="cursor: pointer;color: #cca33c;" :to="{path:'/TransactionDetailed/' + scope.row.hash}">{{scope.row.hash}}</router-link></template>
    </el-table-column>
    <el-table-column
      prop="eggused"
      :label="$lang('GASUSED')">
      <template slot-scope='scope' >{{scope.row.eggused === null?'0':scope.row.eggused}}</template>
    </el-table-column>
    <el-table-column
      prop="value"
      :label="$lang('REWARD')">
    </el-table-column>
  </el-table>
  <el-pagination
	  v-if="transactionList.pages !== 0"
	  layout="prev, pager, next"			  
	  :total="transactionList.pages * 10"
	  @current-change="getTransactionByMindAddress"
	  >
	</el-pagination>
</div>
</template>

<script>
import axios from 'axios';
import url from '@/api/url.js';
export default {
	data(){
		return {
			currentPage:1, // 分页当前页
			pageSize:5, // 每页条数
			pageTotal:100,
			transactionList: [],
		}
	},
	created(){
		this.getTransactionByMindAddress(1);
	},
	methods:{
		changePage(currentPage){
			this.currentPage = currentPage;
			// this.getPageList();
        },
        getTransactionByMindAddress(type){
            let that = this
            const loading = this.$loading({
                text: that.$lang('loading'),
                spinner: 'el-icon-loading',
                background: 'rgba(0, 0, 0, 0.7)'
            });
            axios.get(url.urlblockH + '/transaction/getTransactionByMindAddress', {
                params: {
                    pageNum: type,
                    pageSize: 5,
                    address: that.$route.params.id
                }
            })
            .then(function (res) {
                that.transactionList = res.data.data
                loading.close()
            })
            .catch(function (error) {
                console.log(error);
                loading.close()
            })
        },
		// async getList(){
			
		// 	try {
		// 		const res = await gets.pageList('/transaction/getTransactionByMindAddress', {
		// 			address:this.$parent.paramsId,
		// 			pageNum:this.currentPage,
		// 			pageSize:this.pageSize
		// 		});
		// 		this.pageTotal = res.pages;
		// 		this.list = res.list;
		// 		console.log(this.list);
		// 	} catch (e) {
		// 		throw e;
		// 	}
		// }
	}
}
</script>

<style lang="scss">

</style>